package servlet;

import com.google.gson.Gson;
import dao.DB;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/candyappSer")
public class addPagenotes extends HttpServlet {

//保存聊天框数据
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        String uid =req.getParameter("uid");
        String fid =req.getParameter("fid");
        String ww =req.getParameter("chaw");
        int tmp= DB.executeUpdate("INSERT INTO `pagenotes`( `Tuid`, `Tfid`, `notes`) " +
                "VALUES (?, ?, ?);",uid,fid,ww);

//        resp.sendRedirect("/page.jsp");
//        req.getSession().setAttribute("msg1","修改成功");
        resp.getWriter().print(new Gson().toJson(tmp));

    }
}
